package com.example.test;

import java.util.Calendar;
import java.util.concurrent.Callable;

/**
 * TODO: 这里要写注释的!
 */
public class TaskValidator implements Callable<String> {
    private UserValidator userValidator;
    private String user;
    private String password;

    public TaskValidator(UserValidator userValidator,String user,String password){
        this.userValidator= userValidator;
        this.user= user;
        this.password= password;
    }

    @Override public String call() throws Exception {
        if(!userValidator.validate(user,password)){
            System.out.printf("%s the user has not been found\n",userValidator.getName());
            throw new Exception("error validating user");
        }
        System.out.printf("%s: the user bas been found\n",userValidator.getName());
        return userValidator.getName();
    }

}
